<?php

namespace Common\Model;

/**
 * CityModel.class实例模型
 * 
 * @author songanwei
 * @date 2016-1-5
 */
class CityModel extends BaseModel {

    protected $trueTableName = 'bk_city';

    /**
     * 返回所在省的所有城市
     * @param integer $provinceId  省份ID
     * @return type
     */
    public function getAllByProvince($provinceId) {
        $where = array(
            'isdelete' => 0,
            'province_id' => $provinceId
        );
        return $this->where($where)->select();
    }

    /**
     * 返回城市名称
     * @param integer $cityId 城市ID
     * @return type
     */
    public function getName($cityId) {
        return $this->where(array('id' => $cityId))->getField('name');
    }

}
